package com.jm.offer.easy;

/**
 * @Description https://leetcode-cn.com/problems/qing-wa-tiao-tai-jie-wen-ti-lcof/
 * @date 2022/4/7 9:59
 */
public class _10_2青蛙跳台问题 {
    public static void main(String[] args) {

    }

    /**
     * 青蛙可以条一个台阶也可以条两个台阶，请问有多少种跳法
     * 求斐波那契数列第n项
     * @param n
     * @return
     */
    public static int numWays(int n) {
        int a = 1, b = 1, sum;
        for(int i = 0; i < n; i++){
            sum = (a + b) % 1000000007;
            a = b;
            b = sum;
        }
        return a;
    }
}
